package com.shuyun.xxx.guava.practice;

import java.util.concurrent.CountDownLatch;

/**
 * Created by goodb on 2017/5/18.
 */
public class CountDownLatchTest {
    private static CountDownLatch countDownLatch = new CountDownLatch(2);

    public static void main(String[] args) throws InterruptedException {
        Thread t1 = new Thread(() -> {
            countDownLatch.countDown();
            System.out.println(Thread.currentThread().getName() + ", file1 succeed");
        });
        Thread t2 = new Thread(() -> {
            countDownLatch.countDown();
            System.out.println(Thread.currentThread().getName() + ", file2 succeed");
        });
        t1.start();
        t1.start();
        countDownLatch.await();
        System.out.println("all succeed");
    }
}
